<?php $this->_extends('_layouts/default_layout'); ?>
<?php echo $this->_block('title')?>
<?php echo $config['sitename'] ?>
<?php echo $this->_endblock()?>
<?php echo $this->_block('meta')?>
<meta
	name="keywords" content="<?php echo $config['keyword'] ?>" />
<meta
	name="description" content="<?php echo $config['description'] ?>">
<link
	rel="stylesheet" href="<?php echo $_BASE_DIR; ?>css/login.css"
	type="text/css" />
<!-- 
		<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>js/base.js"></script>
		<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>js/miniWin.js"></script>
		<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>js/loginUtil.js"></script>
		 -->
<script
	type="text/javascript"
	src="<?php echo $_BASE_DIR; ?>javascripts/jquery.min.js"></script>
<?php echo $this->_endblock()?>
<?php $this->_block('center'); ?>
<div id="maincon">

	<div id="loginzone">
		<table width="340" border="0" cellspacing="0" cellpadding="0"
			class="loginta" style="line-height: 35px;">
			<tr>
				<td colspan="3" height="28" style="padding-top: 0px;"><label
					id="page_msg"> </label>
				</td>
			</tr>
			<tr>
				<td width="65"><div style="width: 65px; text-align: right">
						<strong>帐&nbsp;&nbsp;号&nbsp;&nbsp;</strong>
					</div></td>
				<td width="168"><input type="text" name="userid"
					onKeyDown="clearMsg();" id="username" style="ime-mode: disabled"></td>
			</tr>
			<tr>
				<td><div style="width: 65px; text-align: right">
						<strong>密&nbsp;&nbsp;码&nbsp;&nbsp;</strong>
					</div></td>
				<td><input type="password" name="userpass" id="password"
					onKeyDown="clearMsg();" />&nbsp;&nbsp;<a
					href="<?php echo url('users/getpwd')?>">忘记密码？</a>
				</td>
			</tr>
			<tr>
				<td><div style="width: 65px; text-align: right">
						<strong>验证码&nbsp;&nbsp;</strong>
					</div></td>
				<td><input type="text" name="rndcode" id="password" tabindex="2"
					style="ime-mode: disabled; width: 60px" onKeyDown="clearMsg();"
					maxlength="4" /> <img id="rndcode" width='80' height='25'
					border="0" src="<?php echo url('default::interface/code'); ?>"
					onclick='this.src="<?php echo url('default::interface/code')?>/"+ Math.random()' />
				</td>
			</tr>
			<tr>
				<td colspan="3" style="text-align: center"><input width="126" height="42"
					onclick="users_login();return false;" type="image"
					src="<?php echo $_BASE_DIR; ?>images/account/image/login/login_05.jpg"
					 /><input width="126" height="42"
					onClick="window.location='<?php echo url('users/reg')?>'" type="image"
					src="<?php echo $_BASE_DIR; ?>images/account/image/login/login_reg.jpg"
					 />
				</td>
			</tr>
		</table>
		<p style="padding-top: 8px;">
			还未注册DO CALL?&nbsp;&nbsp;<a href="<?php echo url('users/reg')?>">立即注册</a>
		</p>
	</div>

</div>

<?php $this->_endblock(); ?>
<?php $this->_block('scripts'); ?>

<script type="text/javascript">
		function clearMsg()
		{
			$('#page_msg').html('');	
			}
		function users_login()
		{
			
			var userid = $('#username');
			
			var userpass = $('#password');
			var rndcode = $('input[name=rndcode]');
			var tips = $('#page_msg');
			var img = $('#rndcode');
			if(userid.val() == '')
			{
				tips.html('账号必须输入');
				userid.select();
				return false;
				}else if(userpass.val() == '')
				{
					tips.html('密码必须输入');
					userpass.select();
					return false;
					}else if (rndcode.val() == '')
					{
						tips.html('验证码必须输入');
						rndcode.select();
						return false;
						}else
						{
						//POST
							   $.post(
									    "<?php echo url("default::users/login")?>",
										'userid='+userid.val()+'&userpass='+userpass.val()+'&rndcode='+rndcode.val()
									    ,
									    function(data) {	
										    if(data.status)
										    {
										    	window.location.href = data.url;
											}else
											{
												tips.html(data.message);
												//alert(img[0].src);
												//img.src = '<?php echo url('default::interface/code')?>/'+ Math.random();
												img.attr("src",'<?php echo url('default::interface/code')?>/'+ Math.random());
												}
									    },
									    "json"
									);
							}

			return false;
			}
		</script>
<?php $this->_endblock(); ?>